package safari.model.admin;

import java.sql.SQLException;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;

import safari.model.member.MemberVO;
import safari.model.sell.TradeHistoryVO;

public class AdminDaoImpl implements AdminDao {
	private SqlSessionTemplate	sqlSessionTemplate;
	//AdminDaoImpl 생성자
	public AdminDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
		super();
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	/*
	 * 모든 멤버를 출력
	 */
	@Override
	public List<MemberVO> selectAllMember() throws SQLException {
		return sqlSessionTemplate.selectList("admin.selectAllMember");
	}
	/*
	 * 아이디로 회원 검색
	 */
	@Override
	public MemberVO selectMemberById(String id) throws SQLException {
		return sqlSessionTemplate.selectOne("admin.selectMemberById", id);
	}
	/*
	 * 이름으로 회원 검색
	 */
	@Override
	public List<MemberVO> selectMemberByName(String name) throws SQLException {
		return sqlSessionTemplate.selectList("admin.selectMemberByName", name);
	}
	/*
	 * 주소로 회원 검색
	 */
	@Override
	public List<MemberVO> selectMemberByAddress(String address)
			throws SQLException {
		return sqlSessionTemplate.selectList("admin.selectMemberByAddress", address);
	}
	/*
	 * 모든 거래 내역 출력
	 */
	@Override
	public List<TradeHistoryVO> selectAllTradedHistory() throws SQLException {
		return sqlSessionTemplate.selectList("admin.selectAllTradedHistory");
	}

}
